package dao;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class MySQLiteHelper extends SQLiteOpenHelper{
	private static final String DATABASE_NAME = "DB_Splace_2";
	private static int DATABASE_VERSION=3;
	
	public static final String TABLE_Splace = "S";
    public static final String COLUMN_ID = "id";
    public static final String COLUMN_EMAIL = "email";
    public static final String COLUMN_Phone = "phone";
    public static final String COLUMN_Address = "address";
    public static final String COLUMN_Sex = "sex";
    public static final String COLUMN_Accesstoken = "accesstoken";
    public static final String COLUMN_inuse = "inuse";
    public static final String COLUMN_avatar = "avatar";
    private static final String DATABASE_CREATE = "CREATE TABLE user(id INTEGER primary key,email TEXT,phone TEXT,address TEXT,sex TEXT,accesstoken TEXT,inuse INT,avatar TEXT)";

    public MySQLiteHelper(Context context) {
	    super(context, DATABASE_NAME, null, DATABASE_VERSION);
	  }
    
	@Override
	public void onCreate(SQLiteDatabase database) {
		// TODO Auto-generated method stub
		database.execSQL(DATABASE_CREATE);
	}

	@Override
	public void onUpgrade(SQLiteDatabase database, int arg1, int arg2) {
		// TODO Auto-generated method stub
		database.execSQL("DROP TABLE IF EXISTS " + "user");
        onCreate(database);
	}
}
